<#include "/custom.include"/>

<div class="animated fadeInDown">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>${table.tableAlias}管理</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="fullscreen-link">
                            <i class="fa fa-expand"></i>
                        </a>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <form id="searchForm" role="form" class="form-inline">
                        <#list table.columns as column>
                            <div class="form-group">
                                <label>${column.columnAlias}：</label>
                                <input type="text" name="${column.columnNameLower}" class="form-control" placeholder="${column.columnAlias}">
                            </div>
                        </#list>
                        <div class="form-group">
                            <label class="sr-only">查询</label>
                            <button type="button" class="btn btn-success" onclick="formSearch()"><i class="fa fa-search"></i> 查询</button>
                        </div>
                        <div class="form-group">
                            <label class="sr-only">重置</label>
                            <button type="reset" class="btn btn-default" onclick="resetForm()"><i class="fa fa-rotate-left"></i> 重置</button>
                        </div>
                    </form>
                    <div class="action-div">
                        <button class="btn btn-primary" data-toggle="modal" data-target="#modal" onclick="openModal()"><i class="fa fa-plus"></i> 新增</button>
                        <button class="btn btn-danger" onclick="bulkDel()"><i class="fa fa-minus"></i> 删除</button>
                    </div>
                    <div class="table-responsive">
                        <table id="table" class="table table-striped table-bordered table-hover table-responsive ">
                            <thead>
                            <tr>
                                <th>
                                    <input type="checkbox" class="i-checks allCheck"/>
                                    </th>
                                <#list table.columns as column>
                                <th>${column.columnAlias}</th>
                                </#list>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="modal inmodal fade" id="modal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">关闭</span></button>
                <h6 class="modal-title">添加</h6>
            </div>
            <div class="modal-body">
                <form id="form" role="form" class="form-horizontal">
                    <fieldset>
                        <#list table.columns as column>
                        <div class="form-group">
                            <label class="col-lg-3 control-label">${column.columnAlias}</label>
                            <div class="col-lg-9">
                                <input type="text" name="${column.columnNameLower}" class="form-control" placeholder="${column.columnAlias}" >
                            </div>
                        </div>
                        </#list>
                    </fieldset>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-white" data-dismiss="modal"><i class="fa fa-times"></i> 关闭</button>
                <button type="button" class="btn btn-primary"><i class="fa fa-save"></i> 保存</button>
            </div>
        </div>
    </div>
</div>
<script>
    App.restartGlobalFunction();
    CRUDTable({
        tableColumn: [
        <#list table.columns as column>
        <#if column_has_next>
            "${column.columnNameLower}",
        <#else>
            "${column.columnNameLower}"
        </#if>
        </#list>
        ],
        moduleName: "${classNameFirstLower}"
    });
</script>